import time

def water_stonks(nums):
    korzina = True
    while korzina:
        korzina = False
        for i in range(len(nums) - 1):
            if nums[i] > nums[i + 1]:
                nums[i], nums[i + 1] = nums[i + 1], nums[i]
                korzina = True

def read2list(filename):
    file = open(filename, 'r')
    data = file.readlines()
    return data

r1 = read2list("m1_sorted.txt")
r2 = read2list("m2_reverse.txt")
r3 = read2list("m3_shuffle.txt")

i_go = time.time()
water_stonks(r1)
t_finish = time.time()
print("m1_sorted",round((t_finish-i_go)*1000),"milliseconds")

i_go = time.time()
water_stonks(r2)
t_finish = time.time()
print("m2_reverse",round((t_finish-i_go)*1000),"milliseconds")

i_go = time.time()
water_stonks(r3)
t_finish = time.time()
print("m3_shuffle",round((t_finish-i_go)*1000),"milliseconds")
